//
//  HEHomeServerItemCell.m
//  HealthElderly
//
//  Created by 吴欧 on 2021/5/14.
//  Copyright © 2021 honglutec. All rights reserved.
//

#import "HEHomeServerItemCell.h"
#import "HESickedModel.h"

@interface HEHomeServerItemCell ()

@property (nonatomic, strong) UILabel *serverNameLb;
@property (nonatomic, strong) UILabel *serverDateLb;

@end

@implementation HEHomeServerItemCell


- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
    if (self=[super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        self.selectionStyle = UITableViewCellSelectionStyleNone;
        self.contentView.backgroundColor = KWhiteColor;

        [self initUI];
    }
    return self;
}

- (void)initUI {
    UILabel *serverNameLb = [UILabel new];
    serverNameLb.text = @"服务项目";
    serverNameLb.font = DYFont(17);
    serverNameLb.textAlignment = NSTextAlignmentCenter;
    _serverNameLb = serverNameLb;
    [self.contentView addSubview:serverNameLb];
    
    UILabel *serverDateLb = [UILabel new];
    _serverDateLb = serverDateLb;
    serverDateLb.text = @"服务日期";
    serverDateLb.font = DYFont(17);
    serverDateLb.textAlignment = NSTextAlignmentCenter;
    [self.contentView addSubview:serverDateLb];
    
    UIView *line = [UIView new];
    line.backgroundColor = CSplitLineColor;
    [self.contentView addSubview:line];

 
    NSArray *arr = @[serverNameLb, serverDateLb];
    [arr mas_distributeViewsAlongAxis:MASAxisTypeHorizontal withFixedSpacing:0 leadSpacing:0 tailSpacing:0];
    
    [arr mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self.contentView).offset(15);
        make.bottom.equalTo(self.contentView).offset(-15);
    }];
    
    [line mas_makeConstraints:^(MASConstraintMaker *make) {
        make.centerY.equalTo(serverNameLb);
        make.centerX.equalTo(self.contentView);
        make.width.mas_equalTo(1);
        make.height.mas_equalTo(20);
    }];
}

- (void)configCellWithModel:(HESickedPlanModel *)model indexPath:(NSIndexPath *)indexPath {
    _serverNameLb.text = model.service_name;
    _serverDateLb.text = model.service_date;
}

@end
